#!/bin/bash
##
# argv1: configFileName
# argv2: doc_num
# argv3: latent factor vectors file
# argv4: dst_sim_file
# argv5: start
# argv6: end
# argv7: clusterMap
# argv8: clusterSet
# argv9: table_name
# argv10: id_doc.map
# argv11: collectionName
##
function writeSimConfig() {
    echo '[section_1]'          >  $1
    echo "doc_num  =  $2"       >> $1
    echo "feature_file = $3"    >> $1
    echo "sim_file = $4"        >> $1
    echo "start = $5"           >> $1
    echo "end = $6"             >> $1
    echo "sim_fun = original"   >> $1
    echo "isSample = 0"         >> $1
#echo "inlink_file = /data/sim/lsa_in_link.sort" >> $1
#    echo "relateQuestion_file = /data/sim/doc_sim.trim" >> $1
    echo "isUseCluster=0"       >> $1
    echo "id_doc_map= "${10}    >> $1
    echo "[cluster]"            >> $1
    echo "clusterMap=$7"        >> $1
    echo "clusterSet=$8"        >> $1
    echo "[database]"           >> $1
    echo "isSaveDb = 1"         >> $1
    echo "server = 172.16.9.36"    >> $1
    echo "user = babytree"      >> $1
    echo "password = babytree"  >> $1
    echo "dbname = discussion "        >> $1
    echo "table_name = $9"      >> $1
    echo "mongo_host=172.16.9.36" >> $1
    echo "mongo_collection=${11}" >> $1
}

##
# argv1: configFileName
# argv2: doc_num
# argv3: inlink_file
# argv4: related question file
# argv5: max_step
# argv6: tableName
##
function writeInlinkLowConfig() {
    echo '[section_1]'                >  $1
    echo "doc_num  =  $2"             >> $1
    echo "inlink_file = $3"           >> $1
    echo "relateQuestion_file = $4"   >> $1
    echo "max_step=$5"                >> $1
    echo "[database]"                 >> $1
    echo "server = 172.16.9.36"      >> $1
    echo "user = babytree"            >> $1
    echo "password = babytree"        >> $1
    echo "dbname = discussion "              >> $1
    echo "table_name = $6"            >> $1
}



#writeSimConfig test.txt 123 "/data/lvhongliang/data/ask/1_3/doc_latent_vectors.txt" \
#                   "/data/lvhongliang/data/ask/1_3/doc_sim_1_123.txt" 1 123 \
#                   "/data/lvhongliang/data/ask/1_3/assignCid.txt" "/data/lvhongliang/data/ask/1_3/clusters.sort"
#writeInlinkLowConfig test.txt 315773 "/data/lvhongliang/data/ask/1_3/lsa_inlink.txt" /data/lvhongliang/data/ask/1_3/doc_sim.trim 10 sim_lsa
